package com.liaoye.hellocustomview.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.view.View;

public class TypefaceView extends View {
    private Context mContext;
    public TypefaceView(Context context) {
        super(context);
        this.mContext = context;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint();
        paint.setColor(Color.RED);
        paint.setTextSize(60);

        Typeface typeface = Typeface.createFromAsset(mContext.getAssets(), "fonts/jian_luobo.ttf");
        paint.setTypeface(typeface);
        canvas.drawText("床前明月光", 10, 100, paint);
    }
}
